Decryption functions
This section describes PKCS#11 decryption functions.
C_DecryptInit
This function operates as specified in PKCS#11.
The session will retain its initialized state even when a C_Decrypt
or C_DecryptFinal
operation has occurred.
If the CKF_LOGIN_REQUIRED
flag is set for the Token associated with the provided session the session state must be either CKS_RW_USER_FUNCTIONS
or CKS_RO_USER_FUNCTIONS
,otherwise the error result CKR_USER_NOT_LOGGED_IN
is returned.
If the object referenced by the hKey parameter has the CKA_USAGE_COUNT
attribute its value is incremented by this function.
Synopsis
C_DecryptInit(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
CK_OBJECT_HANDLE hKey
);
C_Decrypt
This function operates as specified in PKCS#11 except for the following:
Symmetric cipher operations are terminated by this function. Although this function terminates the current decryption operation the session’s decryption state is not cleared.
Note
If the mechanism in use is a multi-part mechanism and the data supplied exceeds a single block, that portion of the data is processed regardless of the result returned by the call. For example if 12 bytes are passed to a DES ECB operation, 8 bytes are processed even though an error result (due to the padding requirements not being met) is returned.
Cryptoki specifies that a successful return from one of these functions (when not used for length prediction) should result in the cipher state of that session being reset (to the uninitialized state). ProtectToolkit-C, however, leaves the state initialized so that another operation (using the same key) can be performed without calling the appropriate C_xxxInit function.
Synopsis
C_Decrypt(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pEncryptedData,
CK_ULONG ulEncryptedDataLen,
CK_BYTE_PTR pData,
CK_ULONG_PTR pulDataLen
);
C_DecryptUpdate
This function operates as specified in PKCS#11.
Synopsis
C_DecryptUpdate(CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pEncryptedPart,
CK_ULONG ulEncryptedPartLen,
CK_BYTE_PTR pPart,
CK_ULONG_PTR pulPartLen
);
C_DecryptFinal
This function operates as specified in PKCS#11.
Although this function will terminate the current encryption operation the session’s decryption state will not be cleared.
Cryptoki specifies that a successful return from one of these functions (when not used for length prediction) should result in the cipher state of that session being reset (to the uninitialized state). ProtectToolkit-C, however, leaves the state initialized so that another operation (using the same key) can be performed without calling the appropriate C_xxxInit function.
Synopsis
C_DecryptFinal(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pLastPart,
CK_ULONG_PTR pulLastPartLen
);